import gym
from gym import envs

#  查询当前版本gym环境数量
env_list = envs.registry.keys()
env_ids = [env_item for env_item in env_list]
print('There are {0} envs in gym'.format(len(env_ids)))

# 使用make方法创建环境对象
env = gym.make('CartPole-v1')
print('观测空间 = {}'.format(env.observation_space))
print('动作空间 = {}'.format(env.action_space))
print('动作数 = {}'.format(env.action_space.n))
print('初始状态 = {}'.format(env.state))